package baseTest;

import org.omg.CORBA.MARSHAL;

public class testFind {
    public static void main(String[] args) {

        double[] result = findIntersectionPoints(360,1);
        for (double a: result) {
            System.out.println(a);
        }
    }
    public static double[] findIntersectionPoints(float angle, int r){
        angle = angle%360;

        if (angle < 0){
            angle = angle + 360;
        }

        //将角度转换为弧度
        double angleRed = Math.toRadians(angle);

        //求横长
        double across = r * Math.cos(angleRed);

        //求竖
        double vertical = r * Math.sin(angleRed);

        double p1X = r - across;

        double p2X = r + across;

        double p1Y = r + vertical;

        double p2Y = r - vertical;

        double[] result = new double[]{p1X, p1Y, p2X, p2Y};

       return  result;
    }
}
